package practice;

import java.util.ArrayList;
import java.util.Scanner;

public class 枸杞子 {
    public static void main(String[] args) {
        ArrayList shoppingCar = new ArrayList();
        shoppingCar.add("test1");
        shoppingCar.add("test2");
        shoppingCar.add("test3");
        shoppingCar.add("tet4");
        shoppingCar.add("tet5");
        shoppingCar.add("tet6");
        System.out.println(shoppingCar);
        Scanner sc = new Scanner(System.in);
        String myq = sc.next();
        for (int i = 0; i < shoppingCar.size(); i++) {
            String ele = (String) shoppingCar.get(i);
            if (ele.contains(myq)) {
                shoppingCar.remove(i);
                i--;
                System.out.println("成功删除");
                System.out.println(shoppingCar);
            }
        }
    }
}
